package com.nuo.test.classloader;

/**
 * 对于静态字段，只有直接定义这个字段的类才会被初始化（初始化对于这执行static，我个人的猜测）！
 * @author taoyuefeng
 *
 */
public class ClassloadTest1 {
	public static void main(String[] args) {
		test1();
		//test2();
		String s = Thread.currentThread().getContextClassLoader().getClass().getSimpleName();
		System.out.println(s);
	}
	
	
	public static void test1(){
		System.out.println(SubB.value);
	}
	
	public static void test2(){
		SuperA[] ss = new SuperA[10];
		System.out.println(ss.getClass());
	}
}

class SuperA{
	static {
		System.out.println("i am superA!");
	}
	
	
}

class SubB extends SuperA{
	static {
		System.out.println("i am subB!");
	}
	public static int value = 1;
}
